home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ahoy 1986 September
/
Ahoy_Magazine_86-09_1986_Double_L.d64
/
comal article
< prev
next >
Wrap
Text File
|
2022-10-26
|
5KB
|
177 lines
THE BEST FIRST LANGUAGE
by Sol Katz
A question that always comes up when
talking with new computer owners is
"What language should I learn?" For
the C64, the answer must be COMAL.
COMAL (COMmon Algorithmic Language)
is the most user friendly language
written to date. If you read
Compute's Gazette, every couple of
issues, there are programs to improve
BASIC. If you're lucky enough, some
of them work together. COMAL has many
of these improvements built in.
The most user friendly feature of
COMAL is its syntax checker. After
you enter a newly typed line, it
checks it for mistakes. It will point
to where it thinks you made the
mistake and tells you why it isn't
happy. Messages like "Expect a colon
here" or "Unbalanced parenthesis"
help you fix your mistake at the time
you type it. As soon as you correct
the mistake COMAL lets you continue.
In other words, COMAL will not accept
a line with a syntax error.
The next really user friendly feature
of COMAL is automatic formatting.
COMAL wants you to be able to read
your programs, so it takes out extra
spaces in each line and automatically
indents whenever you use structured
programming. COMAL is a structured
programming language, just as Pascal,
C, FORTRAN 77, and COBOL are. Once
you learn COMAL, it is only a small
step to picking up other structured
languages. BASIC (and older versions
of FORTRAN) depend on GOTO statements
for branching, while structured
languages only use GOTO for very
advanced level programming, and
rarely at that. The structures of
COMAL include:
IF...THEN...ELIF...ELSE...ENDIF
CASE..OF...WHEN...OTHERWISE...ENDCASE
WHILE...DO...ENDWHILE
REPEAT...UNTIL
FOR...STEP...ENDFOR
COMAL includes its own disk operating
system so you no longer have to open
channels to the disk drive (eg. OPEN
15,8,15, etc.) before you can use
your drive. You can look at your
directory using CAT (for CATalog)
without destroying a program in
memory. You can easily LOAD, SAVE, or
DELETE a program, all without the
",8" suffix, and/or without opening
the command channel.
COMAL is also user friendly when
entering or editing a program. The
AUTO command automatically supplies
line numbers. [Editor Note: COMAL
uses line numbers only for editing
purposes. They are not used as
addresses as is the case in BASIC].
The syntax of the AUTO command tells
COMAL what line number to start with
and what number to increment the line
number with. So, if you like your
programs to start with 2468 and to go
up with 3's, you can do it. If you
want to delete a range of lines you
do it with:
DELETE linenumber-linenumber.
You can also list a range of lines
the same way, and to be user
friendly, COMAL also lets you stop
and start the listing by hitting the
space bar. COMAL also allows you to
use the existing Commodore screen
editing capabilities.
For advanced users, COMAL has user
defined functions allowing for
multiple statements and multiple
returns, depending on the calculated
values. Compare that with BASIC which
allows only one statement. COMAL
procedures allow local and global
variables, and also allow passing of
arrays as paramenters. If you don't
know what this means, that's OK since
BASIC doesn't allow it anyway, but
FORTRAN, C, and Pascal use procedures
extensively. COMAL allows you to
create new commands using procedures.
Then too, COMAL has Logo-like Turtle
Graphics. If you've read about Logo
and want to try it (or want your kids
to try it) you can have it without
getting still another language disk.
In addition, all the Logo commands
can be used within any COMAL program.
COMAL frees you from dealing with
many of the PEEKs and POKEs that
BASIC requires. If you want to change
the background, border, or text
color, COMAL has commands to do it.
If you want to use regular or high
resolution graphics, COMAL has the
commands to do it, and if you want to
use the tremendous graphics
capabilities of the C64, COMAL has
sprite commands.
These commands let you define,
identify, move, and hide sprites. If
you want to write games, COMAL has
commands to detect collisions between
sprites, and collisions of sprites
with text.
Now we come to user support. COMAL
has a national users group, and small
special interest groups attached to
most Commodore clubs. COMAL USA
publishes a magazine that deals only
with COMAL. They also distribute
public domain COMAL programs on disk.
To the best of my knowledge, there
are no national support groups for
C64 Pascal, C, FORTRAN, COBOL, or
Simon's BASIC. COMAL USA also
maintains electronic bulletin boards
(BBS) on several of the commercial
telecommunications systems. If you're
wondering why the USA (in COMAL USA)
it is because COMAL is the official
educational programming language for
5 European countries. Since COMAL is
a "standardized" language, programs
written on any computer will work on
any other computer that supports
COMAL, including the IBM PC.
COMAL is available on the C64 in two
ways. The disk loaded version 0.14 is
on this Ahoy disk. A more powerful
version of COMAL 2.0 is available in
a cartridge, which works with the C64
and the C128. It costs $74.95 plus
$2.00 shipping. You can obtain these
items along with 18 other COMAL books
from COMAL USA. The standard
reference book for COMAL is the COMAL
Handbook by Len Lindsay.
So, to answer the original question,
COMAL is the best first computer
language, but it may be the only
computer language that you'll ever
need to learn.